<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

function lang($line_key = '', $args = '', $lang = '')
{
    $ci =& get_instance();

    if(!is_array($args))
    {
        $args = array($args);
    }

    $line_key = $ci->lang->line($line_key, $lang);
    
    return vsprintf($line_key, $args);
}

function load_language_working()
{
	$CI =& get_instance(); //initialize application object
	$CI->load->module_model('news', 'language_model', 'language');
	$lang = $CI->session->userdata('lang_working');
	//var_dump($lang);
	if($lang == FALSE)
	{
		$language = $CI->language->get_lang_id('vn'); // Load default language
		//print_r($language);
		$CI->session->set_userdata('lang_working', $language);
	}	
	return $CI->session->userdata('lang_working');
}
// Function to load language for frontpage.
function load_language_frontend()
{
	$CI =& get_instance(); //initialize application object
	$lang = $CI->session->userdata('lang');
	$CI->load->module_model('news', 'language_model', 'language');
		//load language
	if($lang == false)
	{
		$language = $CI->language->get_lang_id('vn');
		$lang = $language;
		$CI->session->set_userdata('lang', $language);
	}
	return $lang;
}
/* End of file language_helper.php */
/* Location: ./application/helpers/language_helper.php */